package io.renren.modules.member.enums;

import lombok.Getter;
import lombok.RequiredArgsConstructor;
import org.apache.commons.lang.StringUtils;

@Getter
@RequiredArgsConstructor
public enum ShapeLevelEnums {

    JIGE("0", "不及格"),

    BUJIGE("1", "及格");

    private final String code;
    private final String text;

    public static String getTextFromCode(String code) {
        String result = "";
        for (ShapeLevelEnums type : values()) {
            if (StringUtils.equals(type.getCode(), code)) {
                result = type.getText();
                break;
            }
        }
        return  result;
    }

    public static String getCodeFromText(String text) {
        String result = text;
        for (ShapeLevelEnums type : values()) {
            if (StringUtils.equals(type.getText(), text)) {
                result = type.getCode();
                break;
            }
        }
        return  result;
    }
}
